import request01 from "@/request01";
import type { addFormType } from "@/views/LayOut/Text/TuserView.vue";

export function getTextUserList() {
  return request01({
    url: '/user',
    method: 'get'
  })
}

export function addTextUser(body: addFormType) {
  return request01({
    url: '/user',
    method: 'post',
    data: body
  })
}

export function delTextUser(id: number) {
  return request01({
    url: '/user/' + id,
    method: 'delete',
  })
}

export function editTextUser(id: number, username: string, password: string, disabled: boolean) {
  return request01({
    url: '/user/' + id,
    method: 'patch',
    data: {
      id,
      username,
      password,
      disabled
    }
  })
}

export function getText() {
  return request01({
    url: '/posts',
    method: 'get',
  })
}

export interface addType {
  title: string,
  content: string
  num: string,
  price: string,
  select: boolean,
  status: boolean,
}

export function addText(body: addType) {
  return request01({
    url: '/posts',
    method: 'post',
    data: body
  })
}
export function deleteText(id: string) {
  return request01({
    url: '/posts/' + id,
    method: 'delete',
  })
}
